import { request } from '@/utils/request';

const getUnreadCountApi = async () => {
  return request.get({
    url: '/message/unread/count',
  });
};

const getLatestMessagesApi = async () => {
  return request.get({
    url: '/message/latest',
  });
};

const getMessagesApi = async (params: any) => {
  return request.post({
    url: '/message/page',
    data: params,
  });
};

const markAsReadApi = async (messageId: number) => {
  return request.get({
    url: `/message/read/${messageId}`,
  });
};

const markAllAsReadApi = async () => {
  return request.get({
    url: '/message/read-all',
  });
};

export { getLatestMessagesApi, getMessagesApi, getUnreadCountApi, markAllAsReadApi, markAsReadApi };
